cmake_minimum_required(VERSION 3.4.1)
project("tao_c_plus")

set(PRJECT_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp)

set(PRJECT_LIB ${CMAKE_CURRENT_SOURCE_DIR}/libs/armeabi-v7a)

file(GLOB cpp-lib ${PRJECT_ROOT_DIR}/*.cpp)
file(GLOB common-c ${PRJECT_ROOT_DIR}/*.c)

file(GLOB common-lib-h ${PRJECT_ROOT_DIR}/libs/*.h)
file(GLOB common-lib-hpp ${PRJECT_ROOT_DIR}/libs/*.hpp)
file(GLOB common-lib-cpp ${PRJECT_ROOT_DIR}/libs/*.cpp)

file(GLOB common-lib-json-h ${PRJECT_ROOT_DIR}/libs/json/include/*.h)
file(GLOB common-lib-json-inl ${PRJECT_ROOT_DIR}/libs/json/*.inl)
file(GLOB common-lib-json-cpp ${PRJECT_ROOT_DIR}/libs/json/*.cpp)

file(GLOB bean-cpp ${PRJECT_ROOT_DIR}/bean/*.cpp)
file(GLOB bean-h ${PRJECT_ROOT_DIR}/bean/*.h)

#该命令会查找指定目录下的所有源文件，然后将结果存进指定变量名
#aux_source_directory(.DIR_SRC)

add_library(
        CPlusPlus
        SHARED


        ${common-c}
        ${cpp-lib}

        ${common-lib-h}
        ${common-lib-hpp}
        ${common-lib-cpp}

        ${common-lib-json-inl}
        ${common-lib-json-cpp}
        ${common-lib-json-h}

        ${bean-cpp}
        ${bean-h}

)
message(${common-lib-cpp})

find_library(
        log-lib
        log
)

add_library(libharu
        SHARED
        IMPORTED
        )
set_target_properties(libharu
        PROPERTIES IMPORTED_LOCATION
        ${PRJECT_LIB}/libharu.so
        )

add_library(libpng
        SHARED
        IMPORTED
        )
set_target_properties(libpng
        PROPERTIES IMPORTED_LOCATION
        ${PRJECT_LIB}/libpng.so
        )


include_directories(${PRJECT_ROOT_DIR}/include/haru)
include_directories(${PRJECT_ROOT_DIR}/include)

target_link_libraries(CPlusPlus libpng libharu ${log-lib})

#   add_executable(<name> [source1]
#   EXCLUDE_FROM_ALL
#   创建名为<name>的target，这个target在make的时候会编译为可执行文件。编译的源文件为[source1] [source2]…。根据平台的不同，编译后的可执行文件名可能为<name>.exe或者<name>。
#

#   add_subdirectory(<pro name>)

#   set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "abcde")
#   RUNTIME_OUTPUT_DIRECTORY
#   OUTPUT_NAME
#   IMPORTED_LOCATION




